package com.hopu.oa.service.impl.notice;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hopu.oa.entity.notice.AoaNoticeList;
import com.hopu.oa.dao.notice.AoaNoticeListDao;
import com.hopu.oa.entity.notice.AoaNoticeUserRelation;
import com.hopu.oa.service.notice.AoaNoticeListService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * (AoaNoticeList)表服务实现类
 *
 * @author makejava
 * @since 2021-11-20 14:09:58
 */
@Service("aoaNoticeListService")
public class AoaNoticeListServiceImpl implements AoaNoticeListService {
    @Resource
    private AoaNoticeListDao aoaNoticeListDao;

    /**
     * 通过ID查询单条数据
     *
     * @param noticeId 主键
     * @return 实例对象
     */
    @Override
    public AoaNoticeList queryById(Integer noticeId) {
        return this.aoaNoticeListDao.queryById(noticeId);
    }

    @Override
    public int forwardother(AoaNoticeUserRelation aoaNoticeUserRelation) {
        return aoaNoticeListDao.forwardother(aoaNoticeUserRelation);
    }

    /**
     * 分页查询
     *
     * @return 查询结果
     */
    @Override
    public List<AoaNoticeList> queryNoticeListById(@Param("id") Integer id, @Param("title") String title, @Param("index") Integer index, @Param("size") Integer size) {
        return this.aoaNoticeListDao.queryNoticeListById(id, title, index, size);
    }


    /**
     * 新增数据
     *
     * @param aoaNoticeList 实例对象
     * @return 实例对象
     */
    @Override
    public AoaNoticeList insert(AoaNoticeList aoaNoticeList) {
        this.aoaNoticeListDao.insert(aoaNoticeList);
        return aoaNoticeList;
    }

    /**
     * 修改数据
     *
     * @param aoaNoticeList 实例对象
     * @return 实例对象
     */
    @Override
    public AoaNoticeList update(AoaNoticeList aoaNoticeList) {
        this.aoaNoticeListDao.update(aoaNoticeList);
        return this.queryById(aoaNoticeList.getNoticeId());
    }

    /**
     * 通过主键删除数据
     *
     * @param noticeId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer noticeId) {
        return this.aoaNoticeListDao.deleteById(noticeId) > 0;
    }
}
